package com.zhang.modules.auth.controller;


import com.zhang.common.web.respWrapper.Res;
import com.zhang.modules.api.annotation.ApiPermission;
import com.zhang.modules.auth.eneity.dto.PermissionDto;
import com.zhang.modules.auth.service.IPermissionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Api(tags = "系统权限管理")
@RequestMapping("/api/permission")
@ApiPermission("sys:permission:*")
public class PermissionController {

    private IPermissionService permissionService;

    public PermissionController(IPermissionService permissionService) {
        this.permissionService = permissionService;
    }

    @ApiOperation("系统权限列表")
    @ApiPermission("sys:permission:tree")
    @GetMapping("/Alltree")
    public Res<List<PermissionDto>> Alltree(){
        List<PermissionDto> result = permissionService.Alltree();
        return Res.ok(result);
    }

}
